//@author A0083782W
// It is a class that will understand a input and extract relevent information

#pragma once

#include <string>
#include "OperationType.h"
#include "SingleAction.h"
#include "WordList.h"
#include "Event.h"
#include "Operations.h"

using std::string;
using CommonDataType::pos_int;
using CommonDataType::con_chr;
using CommonDataType::con_str;
using UCTimeHandler::WordList;
using namespace CommandConstants;
using namespace UCTimeHandler;

class Operations;

class UserCommand:public SingleAction {
public:
	UserCommand ();
	void analyse (con_str& userInput);
	flexiReturnPtr getInput() const;
	void setExpectation (Expection newExpectation);
	Expection getExpectation () const;
	IllegalInput getError() const;

private:
	vector<pos_int> _myNumberList;
	vector<string> _messages;
	MARK_STRUCT _markInfo;
	int _myNumber;
	string _myInputPrompt;
	Expection _myExpectation;
	SEARCH_STRUCT _mySearchInfo;
	IllegalInput _currentStatus;
	OperationType _myHelpNeed;
	MODIFY_STRUCT _myModifyInfo;

	void generateCommand(con_str& userInput);
	void analyseAutoSense(con_str& mainString);
	void analyseAdd(const vector<string>& parameters);
	void analyseDelete (const vector<string>& parameter);
	void analyseModify (const vector<string>& parameters);
 	void analyseSearch (con_str& userInput);
	void analyseFilter (const vector<string>& parameters, vector<SearchFilter>& filterVector);
	void analyseUndo (con_str& parameter);
	void analyseHelp (con_str& parameter);
	void analyseMark (con_str& parameter);
	virtual void reset() override;
};

namespace UserCommandStringFunctions {
	void getStrings (con_str& mainString, vector<pos_int> words);
	void chopKeyWords (con_str& mainString, string& keyWord,string& choppedString);
	OperationType mapKeyWord (con_str& mainString);
	bool getNumberList (con_str& mainString, vector<pos_int>& numberList);
};

using namespace UserCommandStringFunctions;


static void giveMeToOperations (UserCommand *aCommand);